<#include "../../common/nolayout.ftl"/>
<@html css_=['life/user/user.css'] js_=['life/user/user.js']>
<body class="childrenBody">
    <blockquote class="layui-elem-quote news_search">
        <form class="layui-form" id="listForm" action="${root}/user/list?type=${type}" method="post">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" value="" placeholder="请输入用户登录名" name="username" class="layui-input ">
                </div>
                <a class="layui-btn search_btn" lay-submit lay-filter="queryForm">查询</a>
            </div>
            <div class="layui-inline">
                <a class="layui-btn layui-btn-normal usersAdd_btn">添加用户</a>
            </div>
            <div class="layui-inline">
                <a class="layui-btn layui-btn-danger batchDel">批量冻结</a>
            </div>
        </form>
    </blockquote>
    <div class="layui-form users_list">
        <table class="layui-table">
            <thead>
            <tr>
                <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose" id="allChoose"></th>
                <th>头像</th>
                <th>登录名</th>
                <th>昵称</th>
                <th>密码</th>
                <th>手机号码</th>
                <th>邮箱</th>
                <th>会员状态</th>
                <th>是否冻结</th>
                <th>注册时间</th>
                <th>登录时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody id="listDataBody"></tbody>
        </table>
    </div>
    <div  id="page"></div>
</body>

<script type="text/html" id="addUser">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">登录名</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input username" name="username" maxlength="16" placeholder="请输入用户登录名">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input email" name="email" maxlength="16" placeholder="请输入用户邮箱">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input password" name="password" maxlength="16" placeholder="请输入用户密码">
            </div>
        </div>
    </form>
</script>

<script id="dataListTpl" type="text/html">
    {{#  if(d.list!=null&&d.list.length>0){ }}
    {{#  layui.each(d.list, function(index, item){ }}
    <tr>
        <td><input type="checkbox" name="checked" lay-skin="primary" lay-filter="choose"></td>
        <td>
            {{# if(item.headimg){ }}
            <img src="{{item.headimg}}?imageView2/0/w/80/h/40" onclick="headimg('{{item.headimg}}')" onmouseover="headimg('{{item.headimg}}');" lay-filter="headimg">
            {{#} else{ }}
            {{# } }}
        </td>
        <td>{{item.username||''}}</td>
        <td>{{item.nickname||''}}</td>
        <td>{{item.password||''}}</td>
        <td>{{item.phone||''}}</td>
        <td>{{item.email||''}}</td>
        <td>{{d.userStatusMap[item.status]}}</td>
        <td>
            <input type="checkbox" data-id="{{item.id}}" name="show" class="userFrozen" lay-skin="switch" lay-text="是|否" lay-filter="isShow"
                   {{# if(item.status == -1){ }}checked="checked" {{# } }} />
        </td>
        <td>{{ layui.util.toDateString(item.insertDate, 'yyyy-MM-dd HH:mm:ss') }}</td>
        <td>{{ layui.util.toDateString(item.loginTime, 'yyyy-MM-dd HH:mm:ss') }}</td>
        <td>
            <div class="layui-btn-container">
                <a class="layui-btn layui-btn-xs layui-btn-warm userFunctionEdit" data-id="{{item.id}}">
                    <i class="layui-icon">&#xe631</i>授权</a>
                {{# if(item.status==3){ }}
                <a class="layui-btn layui-btn-xs layui-btn-normal userDel" data-id="{{item.id}}" data-status="0">
                    <i class="layui-icon">&#xe640;</i>正常</a>
                {{#} else{ }}
                <a class="layui-btn layui-btn-xs layui-btn-danger userDel" data-id="{{item.id}}" data-status="3">
                    <i class="layui-icon">&#xe640;</i>注销</a>
                {{# } }}
            </div>
        </td>
    </tr>
    {{#  }); }}
    {{#} else { }}
    <tr>
        <td colspan="12" style="text-align: center">无数据</td>
    <tr/>
    {{# }}}

</script>
</@html>